package com.ethink.warehouse.converter;

import org.springframework.beans.BeanUtils;
import org.springframework.stereotype.Component;
import com.ethink.framework.common.converter.Converter;
import com.ethink.warehouse.api.info.LogisticsTraceDetailOrderInfo;
import com.ethink.warehouse.common.entity.LogisticsTraceDetailOrder;

/**
 * 入库/出库单 Converter转换器
 *
 * @author default
 * @date 2022-11-10
 */
@Component
public class LogisticsTraceDetailOrderConverter implements Converter<LogisticsTraceDetailOrderInfo, LogisticsTraceDetailOrder> {

    @Override
    public LogisticsTraceDetailOrder convertTo(LogisticsTraceDetailOrderInfo info) {
        if(info == null) {
            return null;
        }
        LogisticsTraceDetailOrder entity = new LogisticsTraceDetailOrder ();
        BeanUtils.copyProperties(info, entity);
        return entity;
    }

    @Override
    public LogisticsTraceDetailOrderInfo convertFrom(LogisticsTraceDetailOrder entity) {
        if(entity == null) {
            return null;
        }
        LogisticsTraceDetailOrderInfo info = new LogisticsTraceDetailOrderInfo();
        BeanUtils.copyProperties(entity, info);
        return info;
    }
}
